<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Gem::Requirement - rubygems: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-create">::create</a>
    <li ><a href="#method-c-default">::default</a>
    <li ><a href="#method-c-default_prerelease">::default_prerelease</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-parse">::parse</a>
    <li ><a href="#method-i-3D-3D-3D">#===</a>
    <li ><a href="#method-i-3D~">#=~</a>
    <li ><a href="#method-i-_sorted_requirements">#_sorted_requirements</a>
    <li ><a href="#method-i-_tilde_requirements">#_tilde_requirements</a>
    <li ><a href="#method-i-concat">#concat</a>
    <li ><a href="#method-i-exact-3F">#exact?</a>
    <li ><a href="#method-i-none-3F">#none?</a>
    <li ><a href="#method-i-prerelease-3F">#prerelease?</a>
    <li ><a href="#method-i-satisfied_by-3F">#satisfied_by?</a>
    <li ><a href="#method-i-specific-3F">#specific?</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Gem::Requirement">
    <h1 id="class-Gem::Requirement" class="class">
      class Gem::Requirement
    </h1>

    <section class="description">
    
<p>A <a href="Requirement.html"><code>Requirement</code></a> is a set of one or more version restrictions. It supports a few (<code>=, !=, &gt;, &lt;, &gt;=, &lt;=, ~&gt;</code>) different restriction operators.</p>

<p>See <a href="Version.html"><code>Gem::Version</code></a> for a description on how versions and requirements work together in RubyGems.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="DefaultPrereleaseRequirement">DefaultPrereleaseRequirement
          <dd><p>The default requirement matches any version</p>
          <dt id="DefaultRequirement">DefaultRequirement
          <dd><p>The default requirement matches any non-prerelease version</p>
          <dt id="PATTERN">PATTERN
          <dd><p>A regular expression that matches a requirement</p>
        </dl>
        </section>



                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-create" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">create</span><span
                                class="method-args">(*inputs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Factory method to create a <a href="Requirement.html"><code>Gem::Requirement</code></a> object.  Input may be a Version, a String, or nil.  Intended to simplify client code.</p>

<p>If the input is “weird”, the default version requirement is returned.</p>

                              <div class="method-source-code" id="create-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">create</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">inputs</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">new</span> <span class="ruby-identifier">inputs</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">inputs</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>

  <span class="ruby-identifier">input</span> = <span class="ruby-identifier">inputs</span>.<span class="ruby-identifier">shift</span>

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">input</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">input</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>, <span class="ruby-constant">Array</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">new</span> <span class="ruby-identifier">input</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;!&quot;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">source_set</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">input</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:to_str</span>
      <span class="ruby-identifier">new</span> [<span class="ruby-identifier">input</span>.<span class="ruby-identifier">to_str</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">default</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="default-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 76</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default</span>
  <span class="ruby-identifier">new</span> <span class="ruby-string">&quot;&gt;= 0&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_prerelease" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_prerelease</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="default_prerelease-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 80</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_prerelease</span>
  <span class="ruby-identifier">new</span> <span class="ruby-string">&quot;&gt;= 0.a&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(*requirements)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Constructs a requirement from <code>requirements</code>. Requirements can be Strings, Gem::Versions, or Arrays of those. <code>nil</code> and duplicate requirements are ignored. An empty set of <code>requirements</code> is the same as <code>&quot;&gt;= 0&quot;</code>.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 131</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">requirements</span>)
  <span class="ruby-identifier">requirements</span> = <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">flatten</span>
  <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">compact!</span>
  <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">uniq!</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-ivar">@requirements</span> = [<span class="ruby-constant">DefaultRequirement</span>]
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@requirements</span> = <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">map!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">r</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(obj)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parse <code>obj</code>, returning an <code>[op, version]</code> pair. <code>obj</code> can be a String or a <a href="Version.html"><code>Gem::Version</code></a>.</p>

<p>If <code>obj</code> is a String, it can be either a full requirement specification, like <code>&quot;&gt;= 1.2&quot;</code>, or a simple version number, like <code>&quot;1.2&quot;</code>.</p>

<pre class="ruby"><span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;&gt; 1.0&quot;</span>)                 <span class="ruby-comment"># =&gt; [&quot;&gt;&quot;, Gem::Version.new(&quot;1.0&quot;)]</span>
<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;1.0&quot;</span>)                   <span class="ruby-comment"># =&gt; [&quot;=&quot;, Gem::Version.new(&quot;1.0&quot;)]</span>
<span class="ruby-identifier">parse</span>(<span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;1.0&quot;</span>)) <span class="ruby-comment"># =&gt; [&quot;=,  Gem::Version.new(&quot;1.0&quot;)]</span>
</pre>

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 103</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">obj</span>)
  <span class="ruby-keyword">return</span> [<span class="ruby-string">&quot;=&quot;</span>, <span class="ruby-identifier">obj</span>] <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">obj</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">PATTERN</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadRequirementError</span>, <span class="ruby-node">&quot;Illformed requirement [#{obj.inspect}]&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-node">$1</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&gt;=&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;0&quot;</span>
    <span class="ruby-constant">DefaultRequirement</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-node">$1</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&gt;=&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;0.a&quot;</span>
    <span class="ruby-constant">DefaultPrereleaseRequirement</span>
  <span class="ruby-keyword">else</span>
    [<span class="ruby-operator">-</span>(<span class="ruby-node">$1</span> <span class="ruby-operator">||</span> <span class="ruby-string">&quot;=&quot;</span>), <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">$2</span>)]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-3D-3D-3D" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">===</span><span
                                class="method-args">(version)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Requirement.html#method-i-satisfied_by-3F">satisfied_by?</a>
                            </div>
                          </div>

                  <div id="method-i-3D~" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">=~</span><span
                                class="method-args">(version)</span>
                            </div>

                            <div class="method-description">
                              

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Requirement.html#method-i-satisfied_by-3F">satisfied_by?</a>
                            </div>
                          </div>

                  <div id="method-i-concat" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">concat</span><span
                                class="method-args">(new)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Concatenates the <code>new</code> requirements onto this requirement.</p>

                              <div class="method-source-code" id="concat-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 146</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">concat</span>(<span class="ruby-identifier">new</span>)
  <span class="ruby-identifier">new</span> = <span class="ruby-identifier">new</span>.<span class="ruby-identifier">flatten</span>
  <span class="ruby-identifier">new</span>.<span class="ruby-identifier">compact!</span>
  <span class="ruby-identifier">new</span>.<span class="ruby-identifier">uniq!</span>
  <span class="ruby-identifier">new</span> = <span class="ruby-identifier">new</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">r</span> }

  <span class="ruby-ivar">@requirements</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">new</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-exact-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">exact?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if the requirement is for only an exact version</p>

                              <div class="method-source-code" id="exact-3F-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 184</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">exact?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@requirements</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
  <span class="ruby-ivar">@requirements</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;=&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-none-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">none?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>true if this gem has no requirements.</p>

                              <div class="method-source-code" id="none-3F-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 173</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">none?</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@requirements</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
    <span class="ruby-ivar">@requirements</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">DefaultRequirement</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-prerelease-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">prerelease?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A requirement is a prerelease if any of the versions inside of it are prereleases</p>

                              <div class="method-source-code" id="prerelease-3F-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 229</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">prerelease?</span>
  <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">prerelease?</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-satisfied_by-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">satisfied_by?</span><span
                                class="method-args">(version)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>True if <code>version</code> satisfies this <a href="Requirement.html"><code>Requirement</code></a>.</p>

                              <div class="method-source-code" id="satisfied_by-3F-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 242</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">satisfied_by?</span>(<span class="ruby-identifier">version</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Need a Gem::Version: #{version.inspect}&quot;</span> <span class="ruby-keyword">unless</span>
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">version</span>
  <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">op</span>, <span class="ruby-identifier">rv</span><span class="ruby-operator">|</span> <span class="ruby-constant">OPS</span>[<span class="ruby-identifier">op</span>].<span class="ruby-identifier">call</span> <span class="ruby-identifier">version</span>, <span class="ruby-identifier">rv</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Requirement.html#method-i-3D-3D-3D">===</a>, <a href="Requirement.html#method-i-3D~">=~</a>
                            </div>

                          </div>

                  <div id="method-i-specific-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">specific?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>True if the requirement will not always match the latest version.</p>

                              <div class="method-source-code" id="specific-3F-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 254</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">specific?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@requirements</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> <span class="ruby-comment"># GIGO, &gt; 1, &gt; 2 is silly</span>

  <span class="ruby-operator">!</span><span class="ruby-node">%w[&gt; &gt;=]</span>.<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@requirements</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">first</span> <span class="ruby-comment"># grab the operator</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="protected-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Protected Instance Methods</h3>
                </header>

                  <div id="method-i-_sorted_requirements" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_sorted_requirements</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_sorted_requirements-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 280</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_sorted_requirements</span>
  <span class="ruby-ivar">@_sorted_requirements</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">sort_by</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:to_s</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_tilde_requirements" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_tilde_requirements</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_tilde_requirements-source">
            <pre><span class="ruby-comment"># File rubygems/requirement.rb, line 284</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_tilde_requirements</span>
  <span class="ruby-ivar">@_tilde_requirements</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">_sorted_requirements</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;~&gt;&quot;</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

